package com.twu.biblioteca.ui;

import com.twu.biblioteca.domain.Movie;
import com.twu.biblioteca.domain.Repository;
import com.twu.biblioteca.io.IO;

public class ViewMovieListMenuItemHandler implements MenuItemHandler {

    Repository<Movie> movieRepository;
    IO io;

    public ViewMovieListMenuItemHandler(Repository<Movie> movieRepository, IO io) {
        this.movieRepository = movieRepository;
        this.io = io;
    }

    @Override
    public void handle() {
        io.writeOutput(Movie.getHeader());
        for (Movie movie: movieRepository.getAll()) {
            io.writeOutput(movie);
        }
    }
    // public ViewBookListMenuItemHandler(Repository<Book> bookRepository, IO io) {
}
